﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace XMLDOM
{
    class Program
    {
        static void Main(string[] args)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load("demo.xml");

            //Get the first element with an attribute of type ID and value of A111.
            //This displays the node <Person SSN="A111" Name="Fred"/>.
            XmlElement elem = doc.GetElementById("A111");
            Console.WriteLine(elem.OuterXml);

            //Get the first element with an attribute of type ID and value of A222.
            //This displays the node <Person SSN="A222" Name="Tom"/>.
            elem = doc.GetElementById("A222");
            Console.WriteLine(elem.OuterXml); 
        }
    }
}
